import React from 'react';
import {connect} from 'react-redux';
import HeadNavComponent from "../../../components/headNav/index";
import {safeAuto,GoPagePush} from "../../../assets/js/utils/index";
import request from '../../../assets/js/utils/request';
import  Css from '../../../assets/css/home/balance/index.css';
class addressComponentEnd extends React.Component{
    constructor(props){
        super(props);
        safeAuto(props);
        this.state={
            aOderNumData:''
        }
    }

    componentDidMount(){
        this.getOderNum()
    }
    componentWillUnmount(){
        this.setState = (state, callback) => {
            return;
        };
    }
    //获取订单编号
    getOderNum(){
        let sUrl=window.base.config.baseUrl+'order/lastordernum?uid='+this.props.state.redLogin.uid+'&token='+window.base.config.token;
        request(sUrl,'get').then((res)=>{
            if (res.code===200){
                this.setState({aOderNumData:res.data.ordernum})
            }
        })
    }
    goPage(url){
        GoPagePush(this.props,url)
    }
    render(){
        return(
            <div className={Css['main']}>
                <HeadNavComponent title={'订单结束'} ></HeadNavComponent>
                <div className={Css['list']+' '+Css['success']}>订购成功！</div>
                <div className={Css['list']+' '+Css['ordernum']}>订单编号：{this.state.aOderNumData}</div>
                <div className={Css['list']} onClick={this.goPage.bind(this,'order/order?status=all')}>查看订单</div>
                <div className={Css['play_btn']}>去付款</div>
            </div>
        )
    }
}
export default connect((state)=>{
    return{
        state:state
    }
})(addressComponentEnd)